#!/usr/bin/env python3
"""
微博爬虫系统主入口
"""

import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(__file__)))

from app.crawler_app import WeiboCrawlerApp
from config.settings import get_weibo_config

def main():
    """主函数"""
    # 加载配置
    config = get_weibo_config()
    
    # 创建应用
    app = WeiboCrawlerApp(config)
    
    # 定义搜索关键词
    keywords = ['人工智能', '机器学习', '深度学习']
    
    try:
        # 运行分析
        app.run_analysis(
            keywords=keywords,
            pages_per_keyword=3,
            output_dir='data/output'
        )
    except Exception as e:
        print(f"程序运行失败: {e}")
        return 1
    
    return 0

if __name__ == "__main__":
    sys.exit(main())